package com.zdft.promotion.promotion.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zdft.promotion.promotion.bean.PromotionRangeBean;
import com.zdft.promotion.promotion.mapper.PromotionRangeMapper;
import com.zdft.promotion.promotion.service.api.IPromotionRangeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class PromotionRangeServiceImpl extends ServiceImpl<PromotionRangeMapper, PromotionRangeBean> implements IPromotionRangeService {

    @Autowired
    PromotionRangeMapper promotionRangeMapper;

    @Override
    public int findByPromotionRulesId(Long promotionRulesId) {
        QueryWrapper<PromotionRangeBean> query = new QueryWrapper();
        query.lambda().eq(PromotionRangeBean::getPromotionRulesId, promotionRulesId);
        return promotionRangeMapper.selectCount(query);
    }
}